import request from '@/utils/request'
import { param } from '@/utils'

export default {

  // /addrbook/index
  // 个人通讯录列表
  myAddressBook(page){
    return request({
      url: `/addrbook/index`,
      method: 'get',
      params:{pageIndex:page.index,pageSize:page.size}
    })
  },
  // /addrbook/gongSiAddrBook/index
  // 公司通讯录-列表
  companyAddressBook(departmentId){
    return request({
      url: `/addrbook/gongSiAddrBook/index`,
      method: 'get',
      params:{departmentId}
    })
  },

  // /addrbook/gongSiAddrBook/category
  // 公司通讯录-分类
  companyCategory(){
    return request({
      url: `/addrbook/gongSiAddrBook/category`,
      method: 'get',
    })
  },

  // 添加
  save(data,type) {
    return request({
      url: `/addrbook/add/${type}`,
      method: 'post',
      data
    })
  },
  // /addrbook/edit/{fenLei}/{id}
  // 编辑
  edit(data) {
    return request({
      url: `/addrbook/edit/1/${data.id}`,
      method: 'post',
      data
    })
  },
  // /addrbook/deleteByIds
  // 根据id批量删除列表
  delete(data){
    return request({
      url: `/addrbook/deleteByIds`,
      method: 'delete',
      data
    })
  },
  // /addrbook/info/{id}
  // 详情
  getById(id){
    return request({
      url: `/addrbook/info/${id}`,
      method: 'get',
    })
  },

  Fenlist() {
    return request({
      url: `/addrbook/index`,
      method: 'get',
    //   param:user
    })
  },
  // /addrGroup/select/index
  // 选择框所用通讯录分组列表
  groupListBySelect(){
    return request({
      url: `/addrGroup/select/index`,
      method: 'get',
    })
  },
  // /addrGroup/add
  // 新增分组
  addGroup(groupName){
    return request({
      url: `/addrGroup/add`,
      method: 'post',
      data:{groupName}
    })
  },
  /// addrbook/list
  // 更多电话微信等列表配置项
  infoType(){
    return request({
      url: `/addrbook/list`,
      method: 'get',
    })
  },
  // /addrGroup/index
  // 分组列表
  groupList(groupName,page){
    return request({
      url: `/addrGroup/index`,
      method: 'get',
      params:{groupName,pageIndex:page.index,pageSize:page.size}
    })
  },
  // addrGroup/edit/{id}
  // 编辑
  editGroup(group){
    return request({
      url: `/addrGroup/edit/${group.id}`,
      method: 'put',
      data:group
    })
  },
  // /addrGroup/deleteByIds
  // 根据id批量删除列表
  deleteGroups(data){
    return request({
      url: `/addrGroup/deleteByIds`,
      method: 'delete',
      data
    })
  }

}
